package com.rd.student.jike.class4.wanghaixin.Demo;

import java.io.FileWriter;
import java.io.Writer;

public class Student {
    String name;
    int chineseScore;
    int mathScore;

    public Student(String name, int chineseScore, int mathScore) {
        this.name = name;
        this.chineseScore = chineseScore;
        this.mathScore = mathScore;
    }

    public static void main(String[] args) throws Exception {
        Student s1 = new Student("李四",99,88);
        Student s2 = new Student("张三",20,90);
        Student s3 = new Student("王五",100,100);
        String s = "姓名 语文成绩 数学成绩 总分\n";
        s = s + s1.name + " " + s1.chineseScore + " " + s1.mathScore + " " + (s1.chineseScore + s1.mathScore) + "\n";
        s = s + s2.name + " " + s2.chineseScore + " " + s2.mathScore + " " + (s2.chineseScore + s2.mathScore) + "\n";
        s = s + s3.name + " " + s3.chineseScore + " " + s3.mathScore + " " + (s3.chineseScore + s3.mathScore) + "\n";
        Writer w = new FileWriter("Student");
        w.write(s);
        w.close();
    }
}
